package com.cloudbroker.bcs.csvc.sms.mock.service;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import com.cloudbroker.bcs.common.util.ValueUtil;
import com.cloudbroker.bcs.csvc.sms.api.constants.SMSFields;
import com.cloudbroker.bcs.csvc.sms.api.constants.SMSImplTypes;
import com.cloudbroker.bcs.csvc.sms.common.service.SMSServiceAbstractImpl;
import com.cloudbroker.bcs.csvc.sms.common.util.SMSServiceHelper;

@Service(SMSImplTypes.MOCK)
@Lazy
public class SMSServiceMockImpl extends SMSServiceAbstractImpl {
    
    private static final Logger LOGGER = LoggerFactory.getLogger(SMSServiceMockImpl.class);
    
    @Override
    public void sendSingle(Map<String, Object> param, Map<String, Object> result) {
        String mobile = ValueUtil.getString(param.get(SMSFields.MOBILE));
        String content = ValueUtil.getString(param.get(SMSFields.CONTENT));
        LOGGER.info("mock send single: " + mobile + ", content: " + content);
        SMSServiceHelper.markSuccess(result);
    }
    
    @Override
    public void sendBatch(Map<String, Object> param, Map<String, Object> result) {
        LOGGER.info("mock send batch: " + param);
        SMSServiceHelper.markSuccess(result);
    }
    
}
